import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/pages/specialtopic/entity/special_topic_commodity_entity.dart';

SpecialTopicCommodityData $SpecialTopicCommodityDataFromJson(Map<String, dynamic> json) {
  final SpecialTopicCommodityData specialTopicCommodityData = SpecialTopicCommodityData();
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    specialTopicCommodityData.fileUrl = fileUrl;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    specialTopicCommodityData.name = name;
  }
  final SpecialTopicCommodityDataGoodsList? goodsList = jsonConvert.convert<SpecialTopicCommodityDataGoodsList>(json['goodsList']);
  if (goodsList != null) {
    specialTopicCommodityData.goodsList = goodsList;
  }
  return specialTopicCommodityData;
}

Map<String, dynamic> $SpecialTopicCommodityDataToJson(SpecialTopicCommodityData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['fileUrl'] = entity.fileUrl;
  data['name'] = entity.name;
  data['goodsList'] = entity.goodsList?.toJson();
  return data;
}

extension SpecialTopicCommodityDataExtension on SpecialTopicCommodityData {
  SpecialTopicCommodityData copyWith({
    String? fileUrl,
    String? name,
    SpecialTopicCommodityDataGoodsList? goodsList,
  }) {
    return SpecialTopicCommodityData()
      ..fileUrl = fileUrl ?? this.fileUrl
      ..name = name ?? this.name
      ..goodsList = goodsList ?? this.goodsList;
  }
}

SpecialTopicCommodityDataGoodsList $SpecialTopicCommodityDataGoodsListFromJson(Map<String, dynamic> json) {
  final SpecialTopicCommodityDataGoodsList specialTopicCommodityDataGoodsList = SpecialTopicCommodityDataGoodsList();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    specialTopicCommodityDataGoodsList.total = total;
  }
  final List<SpecialTopicCommodityDataGoodsListList>? list = (json['list'] as List<dynamic>?)?.map((e) => jsonConvert.convert<SpecialTopicCommodityDataGoodsListList>(e) as SpecialTopicCommodityDataGoodsListList).toList();
  if (list != null) {
    specialTopicCommodityDataGoodsList.list = list;
  }
  final int? pageNum = jsonConvert.convert<int>(json['pageNum']);
  if (pageNum != null) {
    specialTopicCommodityDataGoodsList.pageNum = pageNum;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    specialTopicCommodityDataGoodsList.pageSize = pageSize;
  }
  final int? size = jsonConvert.convert<int>(json['size']);
  if (size != null) {
    specialTopicCommodityDataGoodsList.size = size;
  }
  final int? startRow = jsonConvert.convert<int>(json['startRow']);
  if (startRow != null) {
    specialTopicCommodityDataGoodsList.startRow = startRow;
  }
  final int? endRow = jsonConvert.convert<int>(json['endRow']);
  if (endRow != null) {
    specialTopicCommodityDataGoodsList.endRow = endRow;
  }
  final int? pages = jsonConvert.convert<int>(json['pages']);
  if (pages != null) {
    specialTopicCommodityDataGoodsList.pages = pages;
  }
  final int? prePage = jsonConvert.convert<int>(json['prePage']);
  if (prePage != null) {
    specialTopicCommodityDataGoodsList.prePage = prePage;
  }
  final int? nextPage = jsonConvert.convert<int>(json['nextPage']);
  if (nextPage != null) {
    specialTopicCommodityDataGoodsList.nextPage = nextPage;
  }
  final bool? isFirstPage = jsonConvert.convert<bool>(json['isFirstPage']);
  if (isFirstPage != null) {
    specialTopicCommodityDataGoodsList.isFirstPage = isFirstPage;
  }
  final bool? isLastPage = jsonConvert.convert<bool>(json['isLastPage']);
  if (isLastPage != null) {
    specialTopicCommodityDataGoodsList.isLastPage = isLastPage;
  }
  final bool? hasPreviousPage = jsonConvert.convert<bool>(json['hasPreviousPage']);
  if (hasPreviousPage != null) {
    specialTopicCommodityDataGoodsList.hasPreviousPage = hasPreviousPage;
  }
  final bool? hasNextPage = jsonConvert.convert<bool>(json['hasNextPage']);
  if (hasNextPage != null) {
    specialTopicCommodityDataGoodsList.hasNextPage = hasNextPage;
  }
  final int? navigatePages = jsonConvert.convert<int>(json['navigatePages']);
  if (navigatePages != null) {
    specialTopicCommodityDataGoodsList.navigatePages = navigatePages;
  }
  final List<int>? navigatepageNums = (json['navigatepageNums'] as List<dynamic>?)?.map((e) => jsonConvert.convert<int>(e) as int).toList();
  if (navigatepageNums != null) {
    specialTopicCommodityDataGoodsList.navigatepageNums = navigatepageNums;
  }
  final int? navigateFirstPage = jsonConvert.convert<int>(json['navigateFirstPage']);
  if (navigateFirstPage != null) {
    specialTopicCommodityDataGoodsList.navigateFirstPage = navigateFirstPage;
  }
  final int? navigateLastPage = jsonConvert.convert<int>(json['navigateLastPage']);
  if (navigateLastPage != null) {
    specialTopicCommodityDataGoodsList.navigateLastPage = navigateLastPage;
  }
  return specialTopicCommodityDataGoodsList;
}

Map<String, dynamic> $SpecialTopicCommodityDataGoodsListToJson(SpecialTopicCommodityDataGoodsList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['pageNum'] = entity.pageNum;
  data['pageSize'] = entity.pageSize;
  data['size'] = entity.size;
  data['startRow'] = entity.startRow;
  data['endRow'] = entity.endRow;
  data['pages'] = entity.pages;
  data['prePage'] = entity.prePage;
  data['nextPage'] = entity.nextPage;
  data['isFirstPage'] = entity.isFirstPage;
  data['isLastPage'] = entity.isLastPage;
  data['hasPreviousPage'] = entity.hasPreviousPage;
  data['hasNextPage'] = entity.hasNextPage;
  data['navigatePages'] = entity.navigatePages;
  data['navigatepageNums'] = entity.navigatepageNums;
  data['navigateFirstPage'] = entity.navigateFirstPage;
  data['navigateLastPage'] = entity.navigateLastPage;
  return data;
}

extension SpecialTopicCommodityDataGoodsListExtension on SpecialTopicCommodityDataGoodsList {
  SpecialTopicCommodityDataGoodsList copyWith({
    int? total,
    List<SpecialTopicCommodityDataGoodsListList>? list,
    int? pageNum,
    int? pageSize,
    int? size,
    int? startRow,
    int? endRow,
    int? pages,
    int? prePage,
    int? nextPage,
    bool? isFirstPage,
    bool? isLastPage,
    bool? hasPreviousPage,
    bool? hasNextPage,
    int? navigatePages,
    List<int>? navigatepageNums,
    int? navigateFirstPage,
    int? navigateLastPage,
  }) {
    return SpecialTopicCommodityDataGoodsList()
      ..total = total ?? this.total
      ..list = list ?? this.list
      ..pageNum = pageNum ?? this.pageNum
      ..pageSize = pageSize ?? this.pageSize
      ..size = size ?? this.size
      ..startRow = startRow ?? this.startRow
      ..endRow = endRow ?? this.endRow
      ..pages = pages ?? this.pages
      ..prePage = prePage ?? this.prePage
      ..nextPage = nextPage ?? this.nextPage
      ..isFirstPage = isFirstPage ?? this.isFirstPage
      ..isLastPage = isLastPage ?? this.isLastPage
      ..hasPreviousPage = hasPreviousPage ?? this.hasPreviousPage
      ..hasNextPage = hasNextPage ?? this.hasNextPage
      ..navigatePages = navigatePages ?? this.navigatePages
      ..navigatepageNums = navigatepageNums ?? this.navigatepageNums
      ..navigateFirstPage = navigateFirstPage ?? this.navigateFirstPage
      ..navigateLastPage = navigateLastPage ?? this.navigateLastPage;
  }
}

SpecialTopicCommodityDataGoodsListList $SpecialTopicCommodityDataGoodsListListFromJson(Map<String, dynamic> json) {
  final SpecialTopicCommodityDataGoodsListList specialTopicCommodityDataGoodsListList = SpecialTopicCommodityDataGoodsListList();
  final String? commodityId = jsonConvert.convert<String>(json['commodityId']);
  if (commodityId != null) {
    specialTopicCommodityDataGoodsListList.commodityId = commodityId;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    specialTopicCommodityDataGoodsListList.id = id;
  }
  final String? spuSpecJsonBody = jsonConvert.convert<String>(json['spuSpecJsonBody']);
  if (spuSpecJsonBody != null) {
    specialTopicCommodityDataGoodsListList.spuSpecJsonBody = spuSpecJsonBody;
  }
  final String? skuCode = jsonConvert.convert<String>(json['skuCode']);
  if (skuCode != null) {
    specialTopicCommodityDataGoodsListList.skuCode = skuCode;
  }
  final String? barCode = jsonConvert.convert<String>(json['barCode']);
  if (barCode != null) {
    specialTopicCommodityDataGoodsListList.barCode = barCode;
  }
  final String? commodityName = jsonConvert.convert<String>(json['commodityName']);
  if (commodityName != null) {
    specialTopicCommodityDataGoodsListList.commodityName = commodityName;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    specialTopicCommodityDataGoodsListList.status = status;
  }
  final int? commodityStatus = jsonConvert.convert<int>(json['commodityStatus']);
  if (commodityStatus != null) {
    specialTopicCommodityDataGoodsListList.commodityStatus = commodityStatus;
  }
  final int? number = jsonConvert.convert<int>(json['number']);
  if (number != null) {
    specialTopicCommodityDataGoodsListList.number = number;
  }
  final int? baseSpec = jsonConvert.convert<int>(json['baseSpec']);
  if (baseSpec != null) {
    specialTopicCommodityDataGoodsListList.baseSpec = baseSpec;
  }
  final int? commodityType = jsonConvert.convert<int>(json['commodityType']);
  if (commodityType != null) {
    specialTopicCommodityDataGoodsListList.commodityType = commodityType;
  }
  final int? commoditySource = jsonConvert.convert<int>(json['commoditySource']);
  if (commoditySource != null) {
    specialTopicCommodityDataGoodsListList.commoditySource = commoditySource;
  }
  final int? commodityForm = jsonConvert.convert<int>(json['commodityForm']);
  if (commodityForm != null) {
    specialTopicCommodityDataGoodsListList.commodityForm = commodityForm;
  }
  final String? supplierName = jsonConvert.convert<String>(json['supplierName']);
  if (supplierName != null) {
    specialTopicCommodityDataGoodsListList.supplierName = supplierName;
  }
  final String? firstClassID = jsonConvert.convert<String>(json['firstClassID']);
  if (firstClassID != null) {
    specialTopicCommodityDataGoodsListList.firstClassID = firstClassID;
  }
  final String? secondClassID = jsonConvert.convert<String>(json['secondClassID']);
  if (secondClassID != null) {
    specialTopicCommodityDataGoodsListList.secondClassID = secondClassID;
  }
  final String? classId = jsonConvert.convert<String>(json['classId']);
  if (classId != null) {
    specialTopicCommodityDataGoodsListList.classId = classId;
  }
  final String? className = jsonConvert.convert<String>(json['className']);
  if (className != null) {
    specialTopicCommodityDataGoodsListList.className = className;
  }
  final String? brandId = jsonConvert.convert<String>(json['brandId']);
  if (brandId != null) {
    specialTopicCommodityDataGoodsListList.brandId = brandId;
  }
  final String? brandName = jsonConvert.convert<String>(json['brandName']);
  if (brandName != null) {
    specialTopicCommodityDataGoodsListList.brandName = brandName;
  }
  final double? taxRate = jsonConvert.convert<double>(json['taxRate']);
  if (taxRate != null) {
    specialTopicCommodityDataGoodsListList.taxRate = taxRate;
  }
  final double? highTaxRate = jsonConvert.convert<double>(json['highTaxRate']);
  if (highTaxRate != null) {
    specialTopicCommodityDataGoodsListList.highTaxRate = highTaxRate;
  }
  final double? highPrice = jsonConvert.convert<double>(json['highPrice']);
  if (highPrice != null) {
    specialTopicCommodityDataGoodsListList.highPrice = highPrice;
  }
  final double? priceCost = jsonConvert.convert<double>(json['priceCost']);
  if (priceCost != null) {
    specialTopicCommodityDataGoodsListList.priceCost = priceCost;
  }
  final double? priceMarket = jsonConvert.convert<double>(json['priceMarket']);
  if (priceMarket != null) {
    specialTopicCommodityDataGoodsListList.priceMarket = priceMarket;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    specialTopicCommodityDataGoodsListList.price = price;
  }
  final int? priceType = jsonConvert.convert<int>(json['priceType']);
  if (priceType != null) {
    specialTopicCommodityDataGoodsListList.priceType = priceType;
  }
  final List<SpecialTopicCommodityDataGoodsListListSpecList>? specList = (json['specList'] as List<dynamic>?)?.map((e) => jsonConvert.convert<SpecialTopicCommodityDataGoodsListListSpecList>(e) as SpecialTopicCommodityDataGoodsListListSpecList).toList();
  if (specList != null) {
    specialTopicCommodityDataGoodsListList.specList = specList;
  }
  final dynamic image = json['image'];
  if (image != null) {
    specialTopicCommodityDataGoodsListList.image = image;
  }
  final String? mainImage = jsonConvert.convert<String>(json['mainImage']);
  if (mainImage != null) {
    specialTopicCommodityDataGoodsListList.mainImage = mainImage;
  }
  final dynamic paySingle = json['paySingle'];
  if (paySingle != null) {
    specialTopicCommodityDataGoodsListList.paySingle = paySingle;
  }
  final List<dynamic>? discountLabel = (json['discountLabel'] as List<dynamic>?)?.map((e) => e).toList();
  if (discountLabel != null) {
    specialTopicCommodityDataGoodsListList.discountLabel = discountLabel;
  }
  final dynamic sort = json['sort'];
  if (sort != null) {
    specialTopicCommodityDataGoodsListList.sort = sort;
  }
  final int? isCombination = jsonConvert.convert<int>(json['isCombination']);
  if (isCombination != null) {
    specialTopicCommodityDataGoodsListList.isCombination = isCombination;
  }
  return specialTopicCommodityDataGoodsListList;
}

Map<String, dynamic> $SpecialTopicCommodityDataGoodsListListToJson(SpecialTopicCommodityDataGoodsListList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['commodityId'] = entity.commodityId;
  data['id'] = entity.id;
  data['spuSpecJsonBody'] = entity.spuSpecJsonBody;
  data['skuCode'] = entity.skuCode;
  data['barCode'] = entity.barCode;
  data['commodityName'] = entity.commodityName;
  data['status'] = entity.status;
  data['commodityStatus'] = entity.commodityStatus;
  data['number'] = entity.number;
  data['baseSpec'] = entity.baseSpec;
  data['commodityType'] = entity.commodityType;
  data['commoditySource'] = entity.commoditySource;
  data['commodityForm'] = entity.commodityForm;
  data['supplierName'] = entity.supplierName;
  data['firstClassID'] = entity.firstClassID;
  data['secondClassID'] = entity.secondClassID;
  data['classId'] = entity.classId;
  data['className'] = entity.className;
  data['brandId'] = entity.brandId;
  data['brandName'] = entity.brandName;
  data['taxRate'] = entity.taxRate;
  data['highTaxRate'] = entity.highTaxRate;
  data['highPrice'] = entity.highPrice;
  data['priceCost'] = entity.priceCost;
  data['priceMarket'] = entity.priceMarket;
  data['price'] = entity.price;
  data['priceType'] = entity.priceType;
  data['specList'] = entity.specList?.map((v) => v.toJson()).toList();
  data['image'] = entity.image;
  data['mainImage'] = entity.mainImage;
  data['paySingle'] = entity.paySingle;
  data['discountLabel'] = entity.discountLabel;
  data['sort'] = entity.sort;
  data['isCombination'] = entity.isCombination;
  return data;
}

extension SpecialTopicCommodityDataGoodsListListExtension on SpecialTopicCommodityDataGoodsListList {
  SpecialTopicCommodityDataGoodsListList copyWith({
    String? commodityId,
    String? id,
    String? spuSpecJsonBody,
    String? skuCode,
    String? barCode,
    String? commodityName,
    int? status,
    int? commodityStatus,
    int? number,
    int? baseSpec,
    int? commodityType,
    int? commoditySource,
    int? commodityForm,
    String? supplierName,
    String? firstClassID,
    String? secondClassID,
    String? classId,
    String? className,
    String? brandId,
    String? brandName,
    double? taxRate,
    double? highTaxRate,
    double? highPrice,
    double? priceCost,
    double? priceMarket,
    double? price,
    int? priceType,
    List<SpecialTopicCommodityDataGoodsListListSpecList>? specList,
    dynamic image,
    String? mainImage,
    dynamic paySingle,
    List<dynamic>? discountLabel,
    dynamic sort,
    int? isCombination,
  }) {
    return SpecialTopicCommodityDataGoodsListList()
      ..commodityId = commodityId ?? this.commodityId
      ..id = id ?? this.id
      ..spuSpecJsonBody = spuSpecJsonBody ?? this.spuSpecJsonBody
      ..skuCode = skuCode ?? this.skuCode
      ..barCode = barCode ?? this.barCode
      ..commodityName = commodityName ?? this.commodityName
      ..status = status ?? this.status
      ..commodityStatus = commodityStatus ?? this.commodityStatus
      ..number = number ?? this.number
      ..baseSpec = baseSpec ?? this.baseSpec
      ..commodityType = commodityType ?? this.commodityType
      ..commoditySource = commoditySource ?? this.commoditySource
      ..commodityForm = commodityForm ?? this.commodityForm
      ..supplierName = supplierName ?? this.supplierName
      ..firstClassID = firstClassID ?? this.firstClassID
      ..secondClassID = secondClassID ?? this.secondClassID
      ..classId = classId ?? this.classId
      ..className = className ?? this.className
      ..brandId = brandId ?? this.brandId
      ..brandName = brandName ?? this.brandName
      ..taxRate = taxRate ?? this.taxRate
      ..highTaxRate = highTaxRate ?? this.highTaxRate
      ..highPrice = highPrice ?? this.highPrice
      ..priceCost = priceCost ?? this.priceCost
      ..priceMarket = priceMarket ?? this.priceMarket
      ..price = price ?? this.price
      ..priceType = priceType ?? this.priceType
      ..specList = specList ?? this.specList
      ..image = image ?? this.image
      ..mainImage = mainImage ?? this.mainImage
      ..paySingle = paySingle ?? this.paySingle
      ..discountLabel = discountLabel ?? this.discountLabel
      ..sort = sort ?? this.sort
      ..isCombination = isCombination ?? this.isCombination;
  }
}

SpecialTopicCommodityDataGoodsListListSpecList $SpecialTopicCommodityDataGoodsListListSpecListFromJson(Map<String, dynamic> json) {
  final SpecialTopicCommodityDataGoodsListListSpecList specialTopicCommodityDataGoodsListListSpecList = SpecialTopicCommodityDataGoodsListListSpecList();
  final int? specNum = jsonConvert.convert<int>(json['specNum']);
  if (specNum != null) {
    specialTopicCommodityDataGoodsListListSpecList.specNum = specNum;
  }
  final double? priceCost = jsonConvert.convert<double>(json['priceCost']);
  if (priceCost != null) {
    specialTopicCommodityDataGoodsListListSpecList.priceCost = priceCost;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    specialTopicCommodityDataGoodsListListSpecList.price = price;
  }
  final double? profit = jsonConvert.convert<double>(json['profit']);
  if (profit != null) {
    specialTopicCommodityDataGoodsListListSpecList.profit = profit;
  }
  final double? highPrice = jsonConvert.convert<double>(json['highPrice']);
  if (highPrice != null) {
    specialTopicCommodityDataGoodsListListSpecList.highPrice = highPrice;
  }
  final double? priceMarket = jsonConvert.convert<double>(json['priceMarket']);
  if (priceMarket != null) {
    specialTopicCommodityDataGoodsListListSpecList.priceMarket = priceMarket;
  }
  final dynamic taxRate = json['taxRate'];
  if (taxRate != null) {
    specialTopicCommodityDataGoodsListListSpecList.taxRate = taxRate;
  }
  return specialTopicCommodityDataGoodsListListSpecList;
}

Map<String, dynamic> $SpecialTopicCommodityDataGoodsListListSpecListToJson(SpecialTopicCommodityDataGoodsListListSpecList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['specNum'] = entity.specNum;
  data['priceCost'] = entity.priceCost;
  data['price'] = entity.price;
  data['profit'] = entity.profit;
  data['highPrice'] = entity.highPrice;
  data['priceMarket'] = entity.priceMarket;
  data['taxRate'] = entity.taxRate;
  return data;
}

extension SpecialTopicCommodityDataGoodsListListSpecListExtension on SpecialTopicCommodityDataGoodsListListSpecList {
  SpecialTopicCommodityDataGoodsListListSpecList copyWith({
    int? specNum,
    double? priceCost,
    double? price,
    double? profit,
    double? highPrice,
    double? priceMarket,
    dynamic taxRate,
  }) {
    return SpecialTopicCommodityDataGoodsListListSpecList()
      ..specNum = specNum ?? this.specNum
      ..priceCost = priceCost ?? this.priceCost
      ..price = price ?? this.price
      ..profit = profit ?? this.profit
      ..highPrice = highPrice ?? this.highPrice
      ..priceMarket = priceMarket ?? this.priceMarket
      ..taxRate = taxRate ?? this.taxRate;
  }
}
